import request from "@/utils/request";

const baseURL = '/train/product'

export const getSkuById =async (skuId:string) => 
  request<Res<ProductSku>>({
    url: `${baseURL}/get-sku-by-id`,
    method: 'GET',
    params: { skuId }
  })

export const getAllNormalSpuPage = async (params:PageParams) =>
  request<Res<{list: ListProductSpu[], total: number}>>({
    url: `${baseURL}/get-all-normal-spu-page`,
    method: 'POST',
    data: params
  })

export const getNormalSpuPageByCategoryId = async (params:PageParams& {categoryId: string}) =>
  request<Res<{list: ListProductSpu[], total: number}>>({
    url: `${baseURL}/get-normal-spu-page-by-category-id`,
    method: 'POST',
    data: params
  })


export const getNormalSpuDetailById = async (spuId:string) =>
  request<Res<ProductSpu>>({
    url: `${baseURL}/get-normal-spu-detail-by-id`,
    method: 'GET',
    params: { spuId }
  })

export const getAllCategoryList = async ()=>
  request<Res<any>>({
    url: `${baseURL}/get-all-category-list`,
    method: 'GET',
  })
